package com.leejxx.user.controller.v1;

import com.leejxx.common.constants.user.AdminConstants;
import com.leejxx.model.common.dto.ResponseResult;
import com.leejxx.model.user.dtos.AuthDto;
import com.leejxx.user.service.ApUserRealNameService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author LeeJx
 * @ClassName ApUserRealNameController
 * @Description TODO
 * @date 2021/2/20 1:08
 * @Version 1.0
 */
@RestController
@Slf4j
@RequestMapping("/api/v1/auth/")
public class ApUserRealNameController {
    @Autowired
    private ApUserRealNameService apUserRealNameService;

    @RequestMapping("/list")
    public ResponseResult loadListByStatus(@RequestBody AuthDto authDto) {
        log.info("[data]{}", authDto);
        return apUserRealNameService.loadListByStatus(authDto);
    }

    @RequestMapping("/authPass")
    public ResponseResult authPass(@RequestBody AuthDto dto) {
        log.info("[data]{}", dto);
        return apUserRealNameService.updateStatusById(dto, AdminConstants.PASS_AUTH);
    }

    @RequestMapping("/authFail")
    public ResponseResult authFail(@RequestBody AuthDto dto) {
        log.info("[data]{}", dto);
        return apUserRealNameService.updateStatusById(dto, AdminConstants.FAIL_AUTH);
    }
}
